home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / etc / bash_completion.d / svk < prev    next >
Text File  |  2009-04-02  |  7KB  |  264 lines

  1. # -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
  2. # ex: ts=8 sw=8 noet filetype=sh
  3. #
  4. # svk completion by Guillaume Rousse <guillomovitch@zarb.org>
  5.  
  6. _svk()
  7. {
  8.     local cur prev commands options command
  9.  
  10.     COMPREPLY=()
  11.     cur=`_get_cword`
  12.  
  13.     commands='add admin annotate ann blame praise cat checkout co cleanup \
  14.         cmerge cm commit ci copy cp delete del remove rm depotmap \
  15.         depot describe desc diff di help h ? import info list ls log \
  16.         merge mirror mi mkdir move mv ren rename patch propdel pd pdel \
  17.         propedit pe pedit propget pg pget proplist pl plist propset ps \
  18.         pset pull push resolved revert smerge sm status st stat switch \
  19.         sw sync sy update up verify'
  20.  
  21.     if [[ $COMP_CWORD -eq 1 ]] ; then
  22.         if [[ "$cur" == -* ]]; then
  23.             COMPREPLY=( $( compgen -W '--version' -- $cur ) )
  24.         else
  25.             COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
  26.         fi
  27.     else
  28.  
  29.         prev=${COMP_WORDS[COMP_CWORD-1]}
  30.         case $prev in
  31.             -@(F|-file|-targets))
  32.                 _filedir
  33.                 return 0;
  34.                 ;;
  35.             --encoding)
  36.                 COMPREPLY=( $( compgen -W \
  37.                     '$( iconv --list | sed -e "s@//@@;" )' \
  38.                     -- "$cur" ) )
  39.                 return 0;
  40.                 ;;
  41.         esac
  42.  
  43.         command=${COMP_WORDS[1]}
  44.  
  45.         if [[ "$cur" == -* ]]; then
  46.             # possible options for the command
  47.             case $command in
  48.                 add)
  49.                     options=' --non-recursive -N -q --quiet'
  50.                     ;;
  51.                 @(blame|annotate|ann|praise))
  52.                     options='-r --revisions -x --cross'
  53.                     ;;
  54.                 cat)
  55.                     options='-r --revision'
  56.                     ;;
  57.                 @(checkout|co))
  58.                     options='-r --revision -q --quiet -N \
  59.                         --non-recursive -l --list -d \
  60.                         --detach --export --relocate \
  61.                         --purge'
  62.                     ;;
  63.                 cleanup)
  64.                     options='-a --all'
  65.                     ;;
  66.                 @(cmerge|cm))
  67.                     options='-c --change -l --log -r \
  68.                         --revision -a --auto \
  69.                         --verbatim --no-ticket -m \
  70.                         --message -F --file --template \                        --encoding -P --patch -S \
  71.                         --sign -C --check-only --direct'
  72.                     ;;
  73.                 @(commit|ci))
  74.                     options='--import -m --message -F \
  75.                         --file --encoding --template \
  76.                         -P --patch -S --sign -C \
  77.                         --check-only -N \
  78.                         --non-recursive --direct'
  79.                     ;;
  80.                 @(copy|cp))
  81.                     options='-r --revision -p --parent -q \
  82.                         --quiet -m --message -F --file \
  83.                         --template --encoding -P \
  84.                         --patch -S --sign -C \
  85.                         --check-only --direct'
  86.                     ;;
  87.                 @(delete|del|remove|rm))
  88.                     options='-k --keep-local -m --message \
  89.                         -F --file --encoding \
  90.                         --template -P --patch -S \
  91.                         --sign -C --check-only --direct'
  92.                     ;;
  93.                 @(depotmap|depot))
  94.                     options='-i --init -l --list -d \
  95.                         --detach --relocate'
  96.                     ;;
  97.                 @(diff|di))
  98.                     options='-r --revision -s --summarize \
  99.                         -b --verbose -N --non-recursive'
  100.                     ;;
  101.                 import)
  102.                     options='-f --from-checkout -t \
  103.                         --to-checkout -m --message -F \
  104.                         --file --template --encoding \
  105.                         -P --patch -S --sign -C \
  106.                         --check-only -N \
  107.                         --non-recursive --direct'
  108.                     ;;
  109.                 @(list|ls))
  110.                     options='-r --revision -v --verbose -R \
  111.                         --recursive -d --depth -f \
  112.                         --full-path'
  113.                     ;;
  114.                 log)
  115.                     options='-r --revision -l --limit -q \
  116.                         --quiet -x --cross -v --verbose'
  117.                     ;;
  118.                 merge)
  119.                     options='-r --revision -c --change -I \
  120.                         --incremental -a --auto -l \
  121.                         --log -s --sync -t --to -f \
  122.                         --from --verbatim --no-ticket \
  123.                         --track-rename -m --message \
  124.                         -F --file --template \
  125.                         --encoding -P --patch -S \
  126.                         --sign -C --check-only --direct'
  127.                     ;;
  128.                 @(mirror|mi))
  129.                     options='-l --list -d --detach \
  130.                         --relocate --recover --unlock \
  131.                         --upgrade'
  132.                     ;;
  133.                 mkdir)
  134.                     options='-p --parent -m --message -F \
  135.                         --file --template --encoding \
  136.                         -P --patch -S --sign -C \
  137.                         --check-only --direct'
  138.                     ;;
  139.                 @(move|mv|rename|ren))
  140.                     options='-r --revision -p --parent -q \
  141.                         --quiet -m --message -F --file \
  142.                         --encoding --template -P \
  143.                         --patch -S --sign -C \
  144.                         --check-only --direct'
  145.                     ;;
  146.                 patch)
  147.                     options='--depot'
  148.                     ;;
  149.                 @(propdel|propset|pdel|pset|pd|ps))
  150.                     options='-R --recursive -r --revision \
  151.                         --revprop -m --message -F \
  152.                         --file --template --encoding \
  153.                         -P --patch -S --sign -C \
  154.                         --check-only -q --quiet \
  155.                         --direct'
  156.                     ;;
  157.                 @(propedit|pedit|pe))
  158.                     options='-R --recursive -r --revision \
  159.                         --revprop -m --message -F \
  160.                         --file --template --encoding \
  161.                         -P --patch -S --sign -C \
  162.                         --check-only --direct'
  163.                     ;;
  164.                 @(propget|pget|pg))
  165.                     options='-R --recursive -r --revision \
  166.                         --revprop --strict'
  167.                     ;;
  168.                 @(proplist|plist|pl))
  169.                     options='-R --recursive -v --verbose \
  170.                         -r --revision --revprop'
  171.                     ;;
  172.                 pull)
  173.                     options='-a --all -l --lump'
  174.                     ;;
  175.                 push)
  176.                     options='-f --from -l --lump -C \
  177.                         --check -P --patch -S --sign \
  178.                         --verbatim'
  179.                     ;;
  180.                 resolved)
  181.                     options='-R --recursive'
  182.                     ;;
  183.                 revert)
  184.                     options='-R --recursive -q --quiet'
  185.                     ;;
  186.                 @(smerge|sm))
  187.                     options='-I --incremental -l --log -B \
  188.                         --baseless -b --base -s --sync \
  189.                         -t --to -f --from --verbatim \
  190.                         --no-ticket --track-rename \
  191.                         --host --remoterev -m \
  192.                         --message -F --file --template \
  193.                         --encoding -P --patch -S \
  194.                         --sign -C --check-only --direct'
  195.                     ;;
  196.                 @(status|stat|st))
  197.                     options='-q --quiet --no-ignore -N \
  198.                         --non-recursive -v --verbose'
  199.                     ;;
  200.                 @(switch|sw))
  201.                     options='-r --revision -d --detach -q \
  202.                         --quiet'
  203.                     ;;
  204.                 @(sync|sy))
  205.                     options='-a --all -s --skipto -t \
  206.                         --torev'
  207.                     ;;
  208.                 @(update|up))
  209.                     options='-r --revision -N \
  210.                         --non-recursive -C \
  211.                         --check-only -s --sync -m \
  212.                         --merge -q --quiet'
  213.                     ;;
  214.             esac
  215.             options="$options --help -h"
  216.  
  217.             COMPREPLY=( $( compgen -W "$options" -- $cur ) )
  218.         else
  219.             case $command in
  220.                 @(help|h|\?))
  221.                     COMPREPLY=( $( compgen -W "$commands \
  222.                     environment commands intro" -- $cur ) )
  223.                     ;;
  224.                 admin)
  225.                     COMPREPLY=( $( compgen -W 'help \
  226.                         deltify dump hotcopy \
  227.                         list-dblogs list-unused-dblogs \
  228.                         load lstxns recover rmtxns \
  229.                         setlog verify rmcache' \
  230.                         -- $cur ) )
  231.                     ;;
  232.                 patch)
  233.                     COMPREPLY=( $( compgen -W '--ls --list \
  234.                         --cat --view --regen \
  235.                         --regenerate --up --update \
  236.                         --apply --rm --delete' \
  237.                         -- $cur ) )
  238.                     ;;
  239.                 sync)
  240.                     COMPREPLY=( $( compgen -W "$( svk \
  241.                         mirror --list 2>/dev/null | \
  242.                         awk '/^\//{print $1}' )" \
  243.                         -- $cur ) )
  244.                     ;;
  245.                 @(co|checkout|push|pull))
  246.                         if [[ "$cur" == //*/* ]]; then
  247.                         path=${cur%/*}/
  248.                     else
  249.                         path=//
  250.                     fi
  251.                     COMPREPLY=( $( compgen -W "$( svk \
  252.                         list $path 2>/dev/null | sed -e 's|\(.*\)|'$path'\1|')" -- $cur ) )
  253.                     ;;
  254.                 *)
  255.                     _filedir
  256.                     ;;
  257.             esac
  258.         fi
  259.     fi
  260.  
  261.     return 0
  262. }
  263. complete -F _svk $default svk
  264.